from django.core.management.base import BaseCommand, CommandError

from rankings.models import Fase, Ranking
from django.utils import timezone
from django.contrib.sites.models import Site


class Command(BaseCommand):
    args = ''
    help = ''

    def handle(self, *args, **kwargs):
        self.stdout.write('Iniciando ranking...')
        fase = Fase(nombre='Fase Inicial', fecha=timezone.now())
        fase.save()

        ranking = Ranking(nombre='Padel Moratalaz', fase_seleccionada=fase, site=Site.objects.get_current())
        ranking.save()
        self.stdout.write('Ranking iniciado correctamente!')

